<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/axios.min.js"></script>
    <script src="/html/util.js"></script>
    <script>
        function add() {
            var face = null;
            var faceList = document.getElementsByName("face");
            for (var i = 0; i < faceList.length; i++){
                if (faceList[i].checked){
                    face = faceList[i].value;
                }
            }


            axios.get("/user/register",{
                params: {
                    name:$("name").value,
                    pwd:$("pwd").value,
                    newPwd:$("newPwd").value,
                    email:$("email").value,
                    face
                }
            }).then(e => {
                if (e.data == "ok"){
                    location.href="/html/login.html"
                }else {
                    $("spanId").innerHTML="注册失败"
                }

            });
        }
    </script>
</head>
<body>
    用户民：<input type="text" id="name"><br>
    用户密码：<input type="password" id="pwd"><br>
    确认密码：<input type="password" id="newPwd"><br>
    用户邮件：<input type="text" id="email"><br>
    用户头像：
    <input type="radio" value="1.jpg" name="face" checked><img src="/html/img/1.jpg" width="50" height="50">
    <input type="radio" value="2.jpg" name="face"><img src="/html/img/2.jpg" width="50" height="50">
    <input type="radio" value="3.jpg" name="face"><img src="/html/img/3.jpg" width="50" height="50">
    <input type="radio" value="4.jpg" name="face"><img src="/html/img/4.jpg" width="50" height="50">
    <input type="radio" value="5.jpg" name="face"><img src="/html/img/5.jpg" width="50" height="50">
    <input type="button" value="注册" onclick="add()">
    <br><span id="spanId"></span>
</body>
</html>